//
//  Extension+UIBarButtonItem.swift
//  XHWeiboSwift
//
//  Created by mac on 17/1/16.
//  Copyright © 2017年 mac.gu. All rights reserved.
//

import UIKit

extension UIBarButtonItem{
    
    convenience init(imageName:String , target:Any? , action:Selector){
        
        self.init()
        
        let btn = UIButton()
        
        btn.setImage(UIImage(named:imageName), for: UIControlState.normal)
        btn.setImage(UIImage(named:"\(imageName)_highlighted"), for: UIControlState.highlighted)
        
        btn.addTarget(target, action: action, for: UIControlEvents.touchUpInside)
        
        
        btn.sizeToFit()
        
        customView = btn
        
        
    }
    
    
}
